package com.fafa.yygh.oss.controller;

import com.fafa.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author Sire
 * @version 1.0
 * @date 2022-02-20 15:08
 */
@Api(tags = "文件管理接口")
@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {

    @Autowired
    private FileService fileService;

    @ApiOperation(value = "文件上传")
    @PostMapping("/fileUpload")
    public String fileUpload(MultipartFile file) {
        String fileUrl = fileService.upload(file);
        return fileUrl;
    }
}
